const DagUtils = require('../dist/dag-utils.cjs');
const edges = [
  {
    source: 'node1',
    target: 'node3'
  },
  {
    source: 'node3',
    target: 'node5'
  },
  {
    source: 'node3',
    target: 'node4'
  },
	{
    source: 'node4',
    target: 'node3'
  }
];
const result = DagUtils.DFSIsLoop(edges);
const result2 = DagUtils.TopologyIsLoop(edges);

if (result) {
  console.log('DFS有环');
} else {
  console.log('DFS无环');
}

if (result2) {
  console.log('Topology有环');
} else {
  console.log('Topology无环');
}